
bool  CaculateWeekDay2(int y, int m, int d)
{
	if (m == 1 || m == 2) {
		m += 12;
		y--;
	}
	int currWeek = (d + 2 * m + 3 * (m + 1) / 5 + y + y / 4 - y / 100 + y / 400) % 7 + 1;
	int dd = currWeek > 5 ? d-(currWeek - 5) : d-currWeek-2; //找到上一个星期五

	int count = 0;
	while (dd > 0)  //找到有几个周日
	{
		count++;
		dd = dd - 7;
	}
	if (currWeek == 5)
	{
		if (count <= 2)
		{
			return false;
		}
		else
		{
			return true;
		}
	}
	else
	{
		if (count == 3)
		{
			return true;
		}
		else
		{
			return false;
		}

	}

}

bool  CaculateWeekDay(int y, int m, int d)
{
	 
	stringstream ss(",m,m,m,xm,dg");
	string str;
	vector<string> vec;
	while (getline(ss,str,','))
	{
		vec.push_back(str);
	}

	if (m == 1 || m == 2) {
		m += 12;
		y--;
	}

	int currWeek = (d + 2 * m + 3 * (m + 1) / 5 + y + y / 4 - y / 100 + y / 400) % 7 + 1;;
	//使用基姆拉尔森计算公式
	int count = 0;
	while (d>0)
	{

		int iWeek = (d + 2 * m + 3 * (m + 1) / 5 + y + y / 4 - y / 100 + y / 400) % 7 + 1;
		d--;
		if (iWeek == 5)
		{
			count++;
		}
	}

	if (count > 3)
	{
		return true;
	}

	else if (count==3)
	{
		if (currWeek == 5)
		{
			return false;
		}
		else
		{
			return true;
		}
	}
	else {


		return false;
	}
	
	

}

